<?php if($this->plan) : ?>
<script type="text/javascript">
    windowname = new Date();
    windowname = windowname.toString();
    xplan=window.open('/loan/calculator/plan',windowname,'menubar=no,scrollbars=yes,resizable=no,width=900,height=480');
    xplan.focus();
</script>
<?php endif; ?>

<script type="text/javascript"> 
    dojo.require("dijit.Tooltip");
    dojo.require("dijit.Menu");   
    window.onload = function() {        
        var product = document.getElementById('LoanProductId');    
        product.onchange = function () { updateFields('/loan/json/get-loan-product-params/id/' + product.value); return false; }        
    }; 
        
    function updateFields(url,callback)
    {
        dojo.xhrGet({
            url: url,
            handleAs: "json",
            timeout: 5000,
            load: function(response, ioArgs) {
                for (index = 0; index < response.length; ++index) {
                    option = response[index];
                    var obj = dojo.byId(option.oV);
                    obj.value = option.oT;
                }   
                callback();
                return response;
            },
            error: function(response, ioArgs) {
                //alert('Failed xhrGet');
                return response;
            }
        });
    }
</script>

<?php echo $this->form ?>